package com.xzlf.controller;

import com.xzlf.feign.FeignService;
import com.xzlf.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class FirstController {

    @Autowired
    private FeignService feignService;

    @GetMapping("/test")
    public List<String> tset() {
        return feignService.testFeign();
    }

    @GetMapping("/getP")
    public User getMultiParams(Integer id, String name) {
        return feignService.getMultiParams(id, name);
    }

    @PostMapping("/postP")
    public User postMultiParams(Integer id, String name) {
        return feignService.postMultiParams(id, name);
    }

    @PostMapping("/postPojo")
    public User postObjectParam(@RequestBody User pojo) {
        return feignService.postObjectParam(pojo);
    }

    @PostMapping("/postLs")
    public List<User> postObjectParam(@RequestBody List<User> userList) {
        return feignService.postObjectList(userList);
    }
}
